package com.qzyh.esb.egsa.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.qzyh.esb.egsa.entity.Requirement;
import com.qzyh.esb.egsa.entity.VersionNo;
import com.qzyh.esb.egsa.mapper.RequirementMapper;
import com.qzyh.esb.egsa.mapper.VersionNoMapper;
import com.qzyh.esb.egsa.service.IVersionNoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 版本号信息表 服务实现类
 * </p>
 *
 * @author whq
 * @since 2023-09-18
 */
@Service
public class VersionNoServiceImpl extends ServiceImpl<VersionNoMapper, VersionNo> implements IVersionNoService {

    @Autowired
    private VersionNoMapper versionNoMapper;

    @Override
    public IPage<VersionNo> getList(IPage<VersionNo> page, String name, String effectiveDate) {
        QueryWrapper<VersionNo> wrapper = Wrappers.query();
        if (StringUtils.hasLength(name)){
            wrapper.like("name", name);
        }
        if (StringUtils.hasLength(effectiveDate)){
            wrapper.like("effective_date", effectiveDate);
        }
        wrapper.orderByDesc("create_time");
        return versionNoMapper.selectPage(page, wrapper);
    }
}
